//
//  MeCommunityListViewController.m
//  DBAChain
//
//  Created by Mxionlly on 2018/9/11.
//  Copyright © 2018年 Evan. All rights reserved.
//

#import "MeCommunityListViewController.h"
#import "MeCommunityListViewCell.h"
#import "taskUserManagerService.h"

@interface MeCommunityListViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView    *tableView;

//@property (nonatomic,strong)    NSArray<dataCommunityLevelInfo*> *    dataInfo;

@end

@implementation MeCommunityListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = [NSString stringWithFormat:@"社区推广（%@级）",self.level];
    [self.view addSubview:self.tableView];
    [self loadData:0];
}

-(void)loadData:(NSInteger) pageIndex{
    NSMutableDictionary *dict = [NSMutableDictionary new];
    [dict setField:[NSString stringWithFormat:@"%ld",(long)pageIndex] value:@"page"];
    [dict setField:@"100" value:@"pageSize"];
    [dict setField:self.level value:@"level"];
//    [DKProgressHUD showLoading];
//    [taskUserManagerService getmyCommunityList:dict success:^(dataCommunityLevel *response, BOOL success) {
//        [DKProgressHUD dismiss];
//        if (success) {
//            self.dataInfo = response.data;
//            [self.tableView reloadData];
//            return ;
//        }
//        [DKProgressHUD showErrorWithStatus:response.message];
//    } failture:^(NSError *error, NSString *strDescription) {
//        [DKProgressHUD dismiss];
//        [DKProgressHUD showErrorWithStatus:strDescription];
//    }];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setBlackStatus:YES];
}

-(UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 114, KScreenWidth, KScreenHeight-114) style:UITableViewStyleGrouped];
        _tableView.dataSource = self;
        _tableView.delegate = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.backgroundColor  = [UIColor clearColor];
        _tableView.scrollEnabled = YES;
        _tableView.estimatedSectionFooterHeight = 0;
        _tableView.estimatedSectionHeaderHeight = 0;
    }
    return _tableView;
}

#pragma mark - UITableView
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//    return [self.dataInfo count];
    return 1;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.00001;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.00001;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 68;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MeCommunityListViewCell *cell = [MeCommunityListViewCell cellWithTableView:tableView];
//    dataCommunityLevelInfo *m = [self.dataInfo objectAtIndex:indexPath.row];
//    dataCommunityLevelInfo *mm = [dataCommunityLevelInfo mj_objectWithKeyValues:m];
//
//    [cell.imgHeader sd_setImageWithURL:[NSURL URLWithString:mm.img] placeholderImage:[UIImage imageNamed:@"icon_icon"]];
//    cell.labelDate.text = mm.date;
//    cell.labelPhone.text = mm.phone;
//    cell.labelReferee.text = mm.referee;
    return cell;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
